import 'dart:io';

import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_massage/common_lib/index.dart';

class CommonOperate {
  ///退出app
  static void exitApp() {
    if (Platform.isAndroid) {
      SystemNavigator.pop(animated: true);
    } else {
      exit(0);
    }
  }

  ///复制文本
  static void copy(String text, {String toast = '复制成功！'}) {
    Clipboard.setData(
      ClipboardData(text: text),
    );
    Loading.toast(toast);
  }

  ///收起键盘
  static void hideKeyboard() => FocusManager.instance.primaryFocus?.unfocus();
}
